package chaoyue.study.config;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;

@Configuration
public class KafkaConfig {

    /**
     * 项目启动时自动创建Topic
     */
    @Bean
    public NewTopic myTopic(){
        return TopicBuilder.name("myTopic")
                .partitions(1)
                .compact()
                .build();
    }
}
